#include("/view/include/single.html")
#@layout()

#define main()
   	<div class="layui-form-item">
        <label class="layui-form-label  required ">原始密码</label>
        <div class="layui-input-inline">
            <input type="password" name="oldpass" lay-filter="oldpass" lay-verify="required" lay-reqtext="原始密码不能为空" min-length="6" maxlength="50"  placeholder="请输入原始密码"
 class="layui-input" id="oldpass">
        </div>
    </div>
   	<div class="layui-form-item">
        <label class="layui-form-label ">新密码</label>
        <div class="layui-input-inline">
            <input type="password" name="newpass" lay-filter="newpass" lay-verify="required" lay-reqtext="新密码不能为空" min-length="6" maxlength="50"  placeholder="请输入新密码"
 class="layui-input" id="newpass">
        </div>
    </div>
   	<div class="layui-form-item">
        <label class="layui-form-label ">确认密码</label>
        <div class="layui-input-inline">
            <input type="password" name="repass" lay-filter="repass" lay-verify="required" lay-reqtext="确认密码不能为空" min-length="6" maxlength="50"  placeholder="请输入确认密码"
 class="layui-input" id="repass">
        </div>
    </div>
#end


#define script()
<script>
    layui.use(['form', 'curd'], function () {
        var form = layui.form,
            layer = layui.layer,
            curd = layui.curd,
            $ = layui.$;

        
        //监听提交
        form.on('submit(submitBtn)', function (data) {
        	if(data.field.newpass != data.field.repass){
        		layer.msg('两次输入的密码不一致',function (index) {    					
	                layer.close(index); // 关闭弹出层        	                
                });
        		return false;
        	}
        	$.post($(data.form).attr('action'), data.field,function(res){
        		if(res.code == '0'){
        			layer.msg(res.msg,function (index) {    					
    	                layer.close(index); // 关闭弹出层        	                
                    });
    			}else{
    				layer.msg(res.msg,function (index) {    
      	      			if(res.url) window.location = res.url;					
    	                layer.close(index); // 关闭弹出层
                    });
    			}
        	});

            return false;
        });
    });
</script>
#end